package cn.com.pagoda.ideplugin.ui;

import com.intellij.openapi.actionSystem.AnActionEvent;

import javax.swing.*;
import java.awt.*;

/**
 * @author 谢璐鑫 on 2023-05-06
 */
public class EncodeAndDecodePanel {

    private final AnActionEvent anActionEvent;
    private JPanel panel;
    private JPanel centerPanel;
    private JTextArea textArea;

    public EncodeAndDecodePanel(AnActionEvent anActionEvent, JPanel mainPanel) {
        this.anActionEvent = anActionEvent;

        panel = new JPanel(new BorderLayout());

        textArea = new JTextArea(30, 60);
        panel.add(textArea, BorderLayout.NORTH);

        centerPanel = new JPanel(new GridBagLayout());
        var c2 = new GridBagConstraints();
        c2.gridx = 0;
        c2.gridy = 0;
        c2.fill = GridBagConstraints.HORIZONTAL;
        centerPanel.add(new JLabel("算法"), c2);
        var c22 = new GridBagConstraints();
        c22.gridx = 0;
        c22.gridy = 1;
        c22.fill = GridBagConstraints.HORIZONTAL;
        centerPanel.add(new JLabel("MD5"), c22);
        var c3 = new GridBagConstraints();
        c3.gridx = 1;
        c3.gridy = 0;
        c3.fill = GridBagConstraints.HORIZONTAL;
        centerPanel.add(new JLabel("编码"), c3);
        var c33 = new GridBagConstraints();
        c33.gridx = 1;
        c33.gridy = 1;
        c33.fill = GridBagConstraints.HORIZONTAL;
        centerPanel.add(new JRadioButton("编"), c33);
        var c4 = new GridBagConstraints();
        c4.gridx = 2;
        c4.gridy = 0;
        c4.fill = GridBagConstraints.HORIZONTAL;
        centerPanel.add(new JLabel("解码"), c4);
        panel.add(centerPanel, BorderLayout.CENTER);

        mainPanel.add(panel, getClass().getSimpleName());
    }
}
